#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

bool IsBrotherWord(string word, string s){   
    if(word.size() == s.size()){
        if(word == s)
            return false;
        sort(word.begin(), word.end());
        sort(s.begin(), s.end());
    }
    return word == s;
}

int main()
{
    int n;   // 字典单词个数
    while(cin >> n){
        string temp;
        // 单词字典
        vector<string> dict(n);
        for(size_t i = 0; i < n; ++i)
            cin >> dict[i];
        sort(dict.begin(), dict.end());   //按字典序
        string word;
        cin >> word;
        int k;
        cin >> k;
        
        // 计数、查找
        int cnt = 0;
        string res;
        for(size_t i = 0; i < dict.size(); ++i){
            if(IsBrotherWord(word, dict[i])){
                ++cnt;
                if(cnt == k) res = dict[i];
            }
        }
        if(!dict.empty()) cout << cnt << endl;
        if(k <= cnt) cout << res << endl;  // 输出第k个符合的结果
    }
    return 0;
}
